/*
* Change Logs:
* Date           Author       Notes
* 2020-10-15     chenbin      
* 2020-11-13     chenbin      
*/
#include "ch32v30x.h"
#include <rtthread.h>
#include "board.h"
//#include "fboot.h"

#ifdef RT_USING_DFS
#include <dfs.h>
#include <dfs_fs.h>
#include <dfs_file.h>
#endif

#ifdef RT_USING_SFUD
#include "spi_flash_sfud.h"
#endif

#include "drv_spi.h"

#undef  DBG_TAG
#undef  DBG_LVL
#define DBG_TAG "flash"
#define DBG_LVL DBG_LOG
#include <rtdbg.h>

int hw_spi_flash_init(void)
{
	rt_hw_spi_device_attach("spi1", "spi10", GPIOA, GPIO_Pin_2);

	if (RT_NULL == rt_sfud_flash_probe("W25Q256", "spi10"))
	{
		return -RT_ERROR;
	};
	return RT_EOK;
}


int board_flash_init(void)
{
	hw_spi_flash_init();
	
//	fal_init();
//	fal_show_part_table();
//
//	fal_blk_device_create("fs");
	
	return RT_EOK;
}


